package com.hnevc.kaoshi;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class DetailActivity extends AppCompatActivity {

    private TextView timuTv;
    private TextView contentTv;
    private TextView priceTv;
    private ImageView imgTv;
    private ImageView imgTv2;
    private ImageView imgTv3;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detail_activity_layout);
        initView();
        initData();
        initEvent();
    }

    private void initView() {
        timuTv = findViewById(R.id.title1);
        contentTv = findViewById(R.id.content1);
        priceTv = findViewById(R.id.jiage);
        imgTv = findViewById(R.id.head_img);
        imgTv2 = findViewById(R.id.jiahao);
        imgTv3 = findViewById(R.id.jianhao);
    }

    private void initData() {
        Intent intent = getIntent();
        String timuStr = intent.getStringExtra("name");
        String contentStr = intent.getStringExtra("content");
        String priceStr = intent.getStringExtra("price");
        int imgStr = intent.getIntExtra("img1",0);
        int imgStr2 = intent.getIntExtra("img2",0);
        int imgStr3 = intent.getIntExtra("img3",0);
        timuTv.setText(timuStr);
        contentTv.setText(contentStr);
        priceTv.setText(priceStr);
        imgTv.setImageResource(imgStr);
        imgTv2.setImageResource(imgStr2);
        imgTv3.setImageResource(imgStr3);
    }

    private void initEvent() {

    }
}
